text:
Q: Sending SMS from excel VBA I have an a excel file with VBA in it already. What I want to do now is using VBA and integrating with what I have already got is to send SMS.I have contacted them where I got the sample code from but I didn't expect much help from them because they didn't know what VBA is.
Here is their sample code:
POST /v1/messages HTTP/1.1
Host: api.messagemedia.com
Accept: application/json
Content-Type: application/json
Authorization: Basic dGhpc2lzYWtleTp0aGlzaXNhc2VjcmV0Zm9ybW1iYXNpY2F1dGhyZXN0YXBp
{
"messages": [

{
  "content": "Hello World",
  "destination_number": "+61491570156",
  "format": "SMS"
     }
   ]
}

From within VBA of course I want to be able to programmaticly change the destination number and the content. At this point I really don't know where to start.

A: Here is the basic sample, which should make an HTTP POST request with the specified parameters:
Sub Test()

    Dim oXHR As Object
    Dim sPayload As String

    sPayload = _
        "{" & vbCrLf & _
        """messages"": [" & vbCrLf & vbCrLf & vbCrLf & _
        "{" & vbCrLf & _
        "  ""content"": ""Hello World""," & vbCrLf & _
        "  ""destination_number"": ""+61491570156""," & vbCrLf & _
        "  ""format"": ""SMS""" & vbCrLf & _
        "     }  " & vbCrLf & _
        "   ]" & vbCrLf & _
        "}"

    Set oXHR = CreateObject("MSXML2.XMLHTTP")
    With oXHR
        .Open "POST", "https://api.messagemedia.com/v1/messages", False
        .SetRequestHeader "Host", "api.messagemedia.com"
        .SetRequestHeader "Accept", "application/json"
        .SetRequestHeader "Content-Type", "application/json"
        .SetRequestHeader "Authorization", "Basic dGhpc2lzYWtleTp0aGlzaXNhc2VjcmV0Zm9ybW1iYXNpY2F1dGhyZXN0YXBp"
        .Send (sPayload)
        Debug.Print .ResponseText
    End With

End Sub


This recently renovated first floor apartment is a must have for any investor or first home buyer. Boasting 2 good sized bedrooms, fully functional kitchen, floorboards and patio. Affordable and freshly painted, with an ideal location within walking distance to both Sunshine and Albion train station. Contact Bill Damianos today to secure this opportunity.


text:
Q: How to set visibility of this frame in Java I have a frame named FiHaStart.
That must close itself and pass another frame named NewPlayer.
frame NewPlayer is opened but the frame FiHaStart still exist(not closed).
What can I do?
import javax.swing.*;
import java.awt.*;
import java.util.Timer;
import java.util.TimerTask;

public class FiHaStart extends JFrame {
 JFrame start;
 JLabel gif;
 JPanel p1;

 Timer timer;

public  FiHaStart(int seconds){     // We have a gif on the frame it takes 7 seconds
    timer = new Timer();            //The frame will be closed after 7 seconds
    timer.schedule(new RemindTask(), seconds*1000);

}

//The problem is probably here.
 class RemindTask extends TimerTask{
    public void run(){
         setVisible(false);

         timer.cancel();
         new NewPlayer();
    }
 }

public FiHaStart() {

  // JLabel backGround = new JLabel(new ImageIcon("images\\new.png"));
  setTitle("FiHa");
  setSize(750, 550);
  setLocationRelativeTo(null); // Center the frame
  // getContentPane().add(backGround);
  setLayout(null);

  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  setVisible(true);
  setResizable(false);

  setContentPane(new JLabel(new ImageIcon("images\\new.png")));

  setIconImage(Toolkit.getDefaultToolkit().getImage("images\\iconfh.png"));

    gif = new JLabel("");
    ImageIcon ikon=new ImageIcon("images\\giff.gif");
    gif.setIcon(ikon);
    gif.setBounds( 210, 350 , 319,36);
    this.add(gif);

    revalidate();
    repaint();

    new FiHaStart(7);
   }
}

A: Why are you calling new FiHaStart(7) at the end of your default constructor? Basically you're creating two FiHaStart instances at the same time.
Why not just start the RemindTask instead of calling new FiHaStart(7) in your default constructor. Something like:
   public FiHaStart() {
       // other code
       timer = new Timer();
       timer.schedule(new RemindTask(), 7*1000);
   }

You should take a look at how to organize your java class constructors. Usually for your default constructor, the compiler will automatically insert the default constructor of the super class or you explicitly invoke a constructor from same class or from the super class using super or this, not new.
Also, you made the constructor FiHaStart(double seconds) as public without initializing the variables inside the instance.
The other problem in your code is it's using a java.util.Timer. For scheduling tasks that will interact with swing components, you should use javax.swing.Timer. Here is a stack overflow post that discussed about it.

A: you have to simulate the click on x button of the frame. try this :
yourframe.dispatchEvent(new WindowEvent(yourframe, WindowEvent.WINDOW_CLOSING));

redpajama_set_name: RedPajamaStackExchange